package demo.dao.impl;

import java.util.List;

import demo.dao.CommentDao;
import demo.entity.Comment;

public class CommentDaoImpl extends GenericDaoImpl<Comment, Long> implements CommentDao {

	@SuppressWarnings("unchecked")
	public List<Object[]> queryCommentByWeiboId(Long weiboid) {
		String queryString = "select c.id, c.content, c.time, c.userid, w.id as weiboid, w.userid as weibouserid, u.nick, u.avatar" +
				" from Comment c, Weibo w, User u" +
				" where c.weiboid=w.id and c.userid=u.id and w.id=" + weiboid +
				" order by c.time desc";
		return getHibernateTemplate().find(queryString);
	}
}
